<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch"
             label-width="68px">
      <el-form-item label="日期" prop="cDate">
        <el-date-picker
          v-model="queryParams.cDate"
          type="date"
          size="small"
          value-format="yyyy-MM-dd"
          @keyup.enter.native="handleQuery"
          placeholder="请输入查询日期">
        </el-date-picker>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索
        </el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>


    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['scrb:tc:add']"
        >新增
        </el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['scrb:tc:edit']"
        >修改
        </el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['scrb:tc:remove']"
        >删除
        </el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['scrb:tc:export']"
        >导出
        </el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="tcList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center"/>
      <el-table-column label="日期" align="center" prop="cDate"/>


      <el-table-column label="电炉规格" align="center" prop="zfree1"/>
      <el-table-column label="电炉钢种" align="center" prop="zfree2"/>
      <el-table-column label="电炉成材率" align="center" prop="zfree3"/>
      <el-table-column label="电炉电耗" align="center" prop="zfree4"/>
      <el-table-column label="电炉燃耗" align="center" prop="zfree5"/>
      <el-table-column label="电炉水耗" align="center" prop="zfree6"/>
      <el-table-column label="电炉当日" align="center" prop="zfree7"/>
      <el-table-column label="电炉累计" align="center" prop="zfree8"/>

      <el-table-column label="特材中频规格" align="center" prop="cTcZpGg"/>
      <el-table-column label="特材中频钢种" align="center" prop="cTcZpGz"/>
      <el-table-column label="特材中频成材率" align="center" prop="cTcZpCcl"/>
      <el-table-column label="特材中频电耗" align="center" prop="cTcZpDh"/>
      <el-table-column label="特材中频燃耗" align="center" prop="cTcZpRh"/>
      <el-table-column label="特材中频水耗" align="center" prop="cTcZpSh"/>
      <el-table-column label="特材中频当日" align="center" prop="cTcZpDr"/>
      <el-table-column label="特材中频累计" align="center" prop="cTcZpLj"/>
      <el-table-column label="特材真空感应规格" align="center" prop="cTcZkgyGg"/>
      <el-table-column label="特材真空感应钢种" align="center" prop="cTcZkgyGz"/>
      <el-table-column label="特材真空感应成材率" align="center" prop="cTcZkgyCcl"/>
      <el-table-column label="特材真空感应电耗" align="center" prop="cTcZkgyDh"/>
      <el-table-column label="特材真空感应燃耗" align="center" prop="cTcZkgyRh"/>
      <el-table-column label="特材真空感应水耗" align="center" prop="cTcZkgySh"/>
      <el-table-column label="特材真空感应当日" align="center" prop="cTcZkgyDr"/>
      <el-table-column label="特材真空感应累计" align="center" prop="cTcZkgyLj"/>
      <el-table-column label="特材电渣规格" align="center" prop="cTcDzGg"/>
      <el-table-column label="特材电渣钢种" align="center" prop="cTcDzGz"/>
      <el-table-column label="特材电渣成材率" align="center" prop="cTcDzCcl"/>
      <el-table-column label="特材电渣电耗" align="center" prop="cTcDzDh"/>
      <el-table-column label="特材电渣燃耗" align="center" prop="cTcDzRh"/>
      <el-table-column label="特材电渣水耗" align="center" prop="cTcDzSh"/>
      <el-table-column label="特材电渣当日" align="center" prop="cTcDzDr"/>
      <el-table-column label="特材电渣累计" align="center" prop="cTcDzLj"/>
      <el-table-column label="特材真空自耗规格" align="center" prop="cTcZkzhGg"/>
      <el-table-column label="特材真空自耗钢种" align="center" prop="cTcZkzhGz"/>
      <el-table-column label="特材真空自耗成材率" align="center" prop="cTcZkzhCcl"/>
      <el-table-column label="特材真空自耗电耗" align="center" prop="cTcZkzhDh"/>
      <el-table-column label="特材真空自耗燃耗" align="center" prop="cTcZkzhRh"/>
      <el-table-column label="特材真空自耗水耗" align="center" prop="cTcZkzhSh"/>
      <el-table-column label="特材真空自耗当日" align="center" prop="cTcZkzhDr"/>
      <el-table-column label="特材真空自耗累计" align="center" prop="cTcZkzhLj"/>
      <el-table-column label="特材成品规格" align="center" prop="cTcCpGg"/>
      <el-table-column label="特材成品钢种" align="center" prop="cTcCpGz"/>
      <el-table-column label="特材成品成材率" align="center" prop="cTcCpCcl"/>
      <el-table-column label="特材成品电耗" align="center" prop="cTcCpDh"/>
      <el-table-column label="特材成品燃耗" align="center" prop="cTcCpRh"/>
      <el-table-column label="特材成品水耗" align="center" prop="cTcCpSh"/>
      <el-table-column label="特材成品当日" align="center" prop="cTcCpDr"/>
      <el-table-column label="特材成品累计" align="center" prop="cTcCpLj"/>
      <!--<el-table-column label="删除标志" align="center" prop="cState"/>-->
      <el-table-column label="备注" align="center" prop="remake"/>
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['scrb:tc:edit']"
          >修改
          </el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['scrb:tc:remove']"
          >删除
          </el-button>
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改特材公司生产日报录入对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="1000px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">

        <el-form-item label="日期" prop="cDate">
          <el-date-picker
            v-model="form.cDate"
            :disabled=!isInsert
            type="date"
            size="small"
            value-format="yyyy-MM-dd"
            placeholder="请输入日期">
          </el-date-picker>
        </el-form-item>

        <table>
          <tr>
            <td width="60px"></td>
            <td>规格</td>
            <td>钢种</td>
            <td>成材率(目标)</td>
            <td>成材率(实际)</td>
            <td>电耗</td>
            <td>燃耗</td>
            <td>水耗</td>
            <td>酸洗当日</td>
            <td>酸洗累计</td>
          </tr>

          <tr>
            <td>电炉</td>
            <td><el-input v-model="form.zfree1" placeholder="请输入电炉规格"/></td>
            <td><el-input v-model="form.zfree2" placeholder="请输入电炉钢种"/></td>
            <td><el-input v-model="form.zfree3" placeholder="请输入电炉成材率(目标)"/></td>
            <td><el-input v-model="form.zfree9" placeholder="请输入电炉成材率(实际)"/></td>
            <td><el-input v-model="form.zfree4" placeholder="请输入电炉电耗"/></td>
            <td><el-input v-model="form.zfree5" placeholder="请输入电炉燃耗"/></td>
            <td><el-input v-model="form.zfree6" placeholder="请输入电炉水耗"/></td>
            <td><el-input v-model="form.zfree7" placeholder="请输入电炉当日"/></td>
            <td><el-input v-model="form.zfree8" placeholder="请输入电炉累计"/></td>
          </tr>

          <tr>
            <td>特材中频</td>
            <td>
              <el-input v-model="form.cTcZpGg" placeholder="请输入特材中频规格"/></td>
            <td>
              <el-input v-model="form.cTcZpGz" placeholder="请输入特材中频钢种"/>
            </td>
            <td>
              <el-input v-model="form.cTcZpCcl" placeholder="请输入特材中频成材率(目标)"/>
            </td>
            <td>
              <el-input v-model="form.zfree10" placeholder="请输入特材中频成材率(实际)"/>
            </td>
            <td>
              <el-input v-model="form.cTcZpDh" placeholder="请输入特材中频电耗"/>
            </td>
            <td>
              <el-input v-model="form.cTcZpRh" placeholder="请输入特材中频燃耗"/>
            </td>
            <td>
              <el-input v-model="form.cTcZpSh" placeholder="请输入特材中频水耗"/>
            </td>
            <td>
              <el-input v-model="form.cTcZpDr" placeholder="请输入特材中频当日"/>
            </td>
            <td>
              <el-input v-model="form.cTcZpLj" placeholder="请输入特材中频累计"/>
            </td>
          </tr>
          <tr>
            <td>真空感应</td>
            <td><el-input v-model="form.cTcZkgyGg" placeholder="请输入特材真空感应规格"/></td>
            <td><el-input v-model="form.cTcZkgyGz" placeholder="请输入特材真空感应钢种"/></td>
            <td><el-input v-model="form.cTcZkgyCcl" placeholder="请输入特材真空感应成材率(目标)"/></td>
            <td><el-input v-model="form.zfree11" placeholder="请输入特材真空感应成材率(实际)"/></td>
            <td><el-input v-model="form.cTcZkgyDh" placeholder="请输入特材真空感应电耗"/></td>
            <td><el-input v-model="form.cTcZkgyRh" placeholder="请输入特材真空感应燃耗"/></td>
            <td><el-input v-model="form.cTcZkgySh" placeholder="请输入特材真空感应水耗"/></td>
            <td><el-input v-model="form.cTcZkgyDr" placeholder="请输入特材真空感应当日"/></td>
            <td><el-input v-model="form.cTcZkgyLj" placeholder="请输入特材真空感应累计"/></td>
          </tr>
          <tr>
            <td>电渣</td>
            <td><el-input v-model="form.cTcDzGg" placeholder="请输入特材电渣规格"/></td>
            <td><el-input v-model="form.cTcDzGz" placeholder="请输入特材电渣钢种"/></td>
            <td><el-input v-model="form.cTcDzCcl" placeholder="请输入特材电渣成材率(目标)"/></td>
            <td><el-input v-model="form.zfree12" placeholder="请输入特材电渣成材率(实际)"/></td>
            <td><el-input v-model="form.cTcDzDh" placeholder="请输入特材电渣电耗"/></td>
            <td><el-input v-model="form.cTcDzRh" placeholder="请输入特材电渣燃耗"/></td>
            <td><el-input v-model="form.cTcDzSh" placeholder="请输入特材电渣水耗"/></td>
            <td><el-input v-model="form.cTcDzDr" placeholder="请输入特材电渣当日"/></td>
            <td><el-input v-model="form.cTcDzLj" placeholder="请输入特材电渣累计"/></td>
          </tr>
          <tr>
            <td>自耗</td>
            <td><el-input v-model="form.cTcZkzhGg" placeholder="请输入特材真空自耗规格"/></td>
            <td><el-input v-model="form.cTcZkzhGz" placeholder="请输入特材真空自耗钢种"/></td>
            <td><el-input v-model="form.cTcZkzhCcl" placeholder="请输入特材真空自耗成材率(目标)"/></td>
            <td><el-input v-model="form.zfree13" placeholder="请输入特材真空自耗成材率(实际)"/></td>
            <td><el-input v-model="form.cTcZkzhDh" placeholder="请输入特材真空自耗电耗"/></td>
            <td><el-input v-model="form.cTcZkzhRh" placeholder="请输入特材真空自耗燃耗"/></td>
            <td><el-input v-model="form.cTcZkzhSh" placeholder="请输入特材真空自耗水耗"/></td>
            <td><el-input v-model="form.cTcZkzhDr" placeholder="请输入特材真空自耗当日"/></td>
            <td><el-input v-model="form.cTcZkzhLj" placeholder="请输入特材真空自耗累计"/></td>
          </tr>
          <tr>
            <td>成品</td>
            <td><el-input v-model="form.cTcCpGg" placeholder="请输入特材成品规格"/></td>
            <td><el-input v-model="form.cTcCpGz" placeholder="请输入特材成品钢种"/></td>
            <td><el-input v-model="form.cTcCpCcl" placeholder="请输入特材成品成材率(目标)"/></td>
            <td><el-input v-model="form.zfree14" placeholder="请输入特材成品成材率(实际)"/></td>
            <td><el-input v-model="form.cTcCpDh" placeholder="请输入特材成品电耗"/></td>
            <td><el-input v-model="form.cTcCpRh" placeholder="请输入特材成品燃耗"/></td>
            <td><el-input v-model="form.cTcCpSh" placeholder="请输入特材成品水耗"/></td>
            <td><el-input v-model="form.cTcCpDr" placeholder="请输入特材成品当日"/></td>
            <td><el-input v-model="form.cTcCpLj" placeholder="请输入特材成品累计"/></td>
          </tr>
        </table>

        <!--<el-form-item label="特材中频规格" prop="cTcZpGg">-->
          <!--<el-input v-model="form.cTcZpGg" placeholder="请输入特材中频规格"/>-->
        <!--</el-form-item>-->
        <!--<el-form-item label="特材中频钢种" prop="cTcZpGz">-->
          <!--<el-input v-model="form.cTcZpGz" placeholder="请输入特材中频钢种"/>-->
        <!--</el-form-item>-->
        <!--<el-form-item label="特材中频成材率" prop="cTcZpCcl">-->
          <!--<el-input v-model="form.cTcZpCcl" placeholder="请输入特材中频成材率"/>-->
        <!--</el-form-item>-->
        <!--<el-form-item label="特材中频电耗" prop="cTcZpDh">-->
          <!--<el-input v-model="form.cTcZpDh" placeholder="请输入特材中频电耗"/>-->
        <!--</el-form-item>-->
        <!--<el-form-item label="特材中频燃耗" prop="cTcZpRh">-->
          <!--<el-input v-model="form.cTcZpRh" placeholder="请输入特材中频燃耗"/>-->
        <!--</el-form-item>-->
        <!--<el-form-item label="特材中频水耗" prop="cTcZpSh">-->
          <!--<el-input v-model="form.cTcZpSh" placeholder="请输入特材中频水耗"/>-->
        <!--</el-form-item>-->
        <!--<el-form-item label="特材中频当日" prop="cTcZpDr">-->
          <!--<el-input v-model="form.cTcZpDr" placeholder="请输入特材中频当日"/>-->
        <!--</el-form-item>-->
        <!--<el-form-item label="特材中频累计" prop="cTcZpLj">-->
          <!--<el-input v-model="form.cTcZpLj" placeholder="请输入特材中频累计"/>-->
        <!--</el-form-item>-->


        <!--<el-form-item label="特材真空感应规格" prop="cTcZkgyGg">-->
          <!--<el-input v-model="form.cTcZkgyGg" placeholder="请输入特材真空感应规格"/>-->
        <!--</el-form-item>-->
        <!--<el-form-item label="特材真空感应钢种" prop="cTcZkgyGz">-->
          <!--<el-input v-model="form.cTcZkgyGz" placeholder="请输入特材真空感应钢种"/>-->
        <!--</el-form-item>-->
        <!--<el-form-item label="特材真空感应成材率" prop="cTcZkgyCcl">-->
          <!--<el-input v-model="form.cTcZkgyCcl" placeholder="请输入特材真空感应成材率"/>-->
        <!--</el-form-item>-->
        <!--<el-form-item label="特材真空感应电耗" prop="cTcZkgyDh">-->
          <!--<el-input v-model="form.cTcZkgyDh" placeholder="请输入特材真空感应电耗"/>-->
        <!--</el-form-item>-->
        <!--<el-form-item label="特材真空感应燃耗" prop="cTcZkgyRh">-->
          <!--<el-input v-model="form.cTcZkgyRh" placeholder="请输入特材真空感应燃耗"/>-->
        <!--</el-form-item>-->
        <!--<el-form-item label="特材真空感应水耗" prop="cTcZkgySh">-->
          <!--<el-input v-model="form.cTcZkgySh" placeholder="请输入特材真空感应水耗"/>-->
        <!--</el-form-item>-->
        <!--<el-form-item label="特材真空感应当日" prop="cTcZkgyDr">-->
          <!--<el-input v-model="form.cTcZkgyDr" placeholder="请输入特材真空感应当日"/>-->
        <!--</el-form-item>-->
        <!--<el-form-item label="特材真空感应累计" prop="cTcZkgyLj">-->
          <!--<el-input v-model="form.cTcZkgyLj" placeholder="请输入特材真空感应累计"/>-->
        <!--</el-form-item>-->


        <!--<el-form-item label="特材电渣规格" prop="cTcDzGg">-->
          <!--<el-input v-model="form.cTcDzGg" placeholder="请输入特材电渣规格"/>-->
        <!--</el-form-item>-->
        <!--<el-form-item label="特材电渣钢种" prop="cTcDzGz">-->
          <!--<el-input v-model="form.cTcDzGz" placeholder="请输入特材电渣钢种"/>-->
        <!--</el-form-item>-->
        <!--<el-form-item label="特材电渣成材率" prop="cTcDzCcl">-->
          <!--<el-input v-model="form.cTcDzCcl" placeholder="请输入特材电渣成材率"/>-->
        <!--</el-form-item>-->
        <!--<el-form-item label="特材电渣电耗" prop="cTcDzDh">-->
          <!--<el-input v-model="form.cTcDzDh" placeholder="请输入特材电渣电耗"/>-->
        <!--</el-form-item>-->
        <!--<el-form-item label="特材电渣燃耗" prop="cTcDzRh">-->
          <!--<el-input v-model="form.cTcDzRh" placeholder="请输入特材电渣燃耗"/>-->
        <!--</el-form-item>-->
        <!--<el-form-item label="特材电渣水耗" prop="cTcDzSh">-->
          <!--<el-input v-model="form.cTcDzSh" placeholder="请输入特材电渣水耗"/>-->
        <!--</el-form-item>-->
        <!--<el-form-item label="特材电渣当日" prop="cTcDzDr">-->
          <!--<el-input v-model="form.cTcDzDr" placeholder="请输入特材电渣当日"/>-->
        <!--</el-form-item>-->
        <!--<el-form-item label="特材电渣累计" prop="cTcDzLj">-->
          <!--<el-input v-model="form.cTcDzLj" placeholder="请输入特材电渣累计"/>-->
        <!--</el-form-item>-->

        <!--<el-form-item label="特材真空自耗规格" prop="cTcZkzhGg">-->
          <!--<el-input v-model="form.cTcZkzhGg" placeholder="请输入特材真空自耗规格"/>-->
        <!--</el-form-item>-->
        <!--<el-form-item label="特材真空自耗钢种" prop="cTcZkzhGz">-->
          <!--<el-input v-model="form.cTcZkzhGz" placeholder="请输入特材真空自耗钢种"/>-->
        <!--</el-form-item>-->
        <!--<el-form-item label="特材真空自耗成材率" prop="cTcZkzhCcl">-->
          <!--<el-input v-model="form.cTcZkzhCcl" placeholder="请输入特材真空自耗成材率"/>-->
        <!--</el-form-item>-->
        <!--<el-form-item label="特材真空自耗电耗" prop="cTcZkzhDh">-->
          <!--<el-input v-model="form.cTcZkzhDh" placeholder="请输入特材真空自耗电耗"/>-->
        <!--</el-form-item>-->
        <!--<el-form-item label="特材真空自耗燃耗" prop="cTcZkzhRh">-->
          <!--<el-input v-model="form.cTcZkzhRh" placeholder="请输入特材真空自耗燃耗"/>-->
        <!--</el-form-item>-->
        <!--<el-form-item label="特材真空自耗水耗" prop="cTcZkzhSh">-->
          <!--<el-input v-model="form.cTcZkzhSh" placeholder="请输入特材真空自耗水耗"/>-->
        <!--</el-form-item>-->
        <!--<el-form-item label="特材真空自耗当日" prop="cTcZkzhDr">-->
          <!--<el-input v-model="form.cTcZkzhDr" placeholder="请输入特材真空自耗当日"/>-->
        <!--</el-form-item>-->
        <!--<el-form-item label="特材真空自耗累计" prop="cTcZkzhLj">-->
          <!--<el-input v-model="form.cTcZkzhLj" placeholder="请输入特材真空自耗累计"/>-->
        <!--</el-form-item>-->

        <!--<el-form-item label="特材成品规格" prop="cTcCpGg">-->
          <!--<el-input v-model="form.cTcCpGg" placeholder="请输入特材成品规格"/>-->
        <!--</el-form-item>-->
        <!--<el-form-item label="特材成品钢种" prop="cTcCpGz">-->
          <!--<el-input v-model="form.cTcCpGz" placeholder="请输入特材成品钢种"/>-->
        <!--</el-form-item>-->
        <!--<el-form-item label="特材成品成材率" prop="cTcCpCcl">-->
          <!--<el-input v-model="form.cTcCpCcl" placeholder="请输入特材成品成材率"/>-->
        <!--</el-form-item>-->
        <!--<el-form-item label="特材成品电耗" prop="cTcCpDh">-->
          <!--<el-input v-model="form.cTcCpDh" placeholder="请输入特材成品电耗"/>-->
        <!--</el-form-item>-->
        <!--<el-form-item label="特材成品燃耗" prop="cTcCpRh">-->
          <!--<el-input v-model="form.cTcCpRh" placeholder="请输入特材成品燃耗"/>-->
        <!--</el-form-item>-->
        <!--<el-form-item label="特材成品水耗" prop="cTcCpSh">-->
          <!--<el-input v-model="form.cTcCpSh" placeholder="请输入特材成品水耗"/>-->
        <!--</el-form-item>-->
        <!--<el-form-item label="特材成品当日" prop="cTcCpDr">-->
          <!--<el-input v-model="form.cTcCpDr" placeholder="请输入特材成品当日"/>-->
        <!--</el-form-item>-->
        <!--<el-form-item label="特材成品累计" prop="cTcCpLj">-->
          <!--<el-input v-model="form.cTcCpLj" placeholder="请输入特材成品累计"/>-->
        <!--</el-form-item>-->
        <!--<el-form-item label="删除标志" prop="cState">-->
        <!--<el-input v-model="form.cState" placeholder="请输入删除标志"/>-->
        <!--</el-form-item>-->
        <el-form-item label="备注" prop="remake">
          <el-input v-model="form.remake" placeholder="请输入备注"/>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
  import {listTc, getTc, delTc, addTc, updateTc} from "@/api/scrb/tc";

  export default {
    name: "Tc",
    data() {
      return {
        // 遮罩层
        loading: true,
        // 选中数组
        ids: [],
        // 非单个禁用
        single: true,
        // 非多个禁用
        multiple: true,
        // 显示搜索条件
        showSearch: true,
        // 总条数
        total: 0,
        // 特材公司生产日报录入表格数据
        tcList: [],
        // 弹出层标题
        title: "",
        // 是否显示弹出层
        open: false,
        // 查询参数
        queryParams: {
          pageNum: 1,
          pageSize: 10,
          cTcZpGg: null,
          cTcZpGz: null,
          cTcZpCcl: null,
          cTcZpDh: null,
          cTcZpRh: null,
          cTcZpSh: null,
          cTcZpDr: null,
          cTcZpLj: null,
          cTcZkgyGg: null,
          cTcZkgyGz: null,
          cTcZkgyCcl: null,
          cTcZkgyDh: null,
          cTcZkgyRh: null,
          cTcZkgySh: null,
          cTcZkgyDr: null,
          cTcZkgyLj: null,
          cTcDzGg: null,
          cTcDzGz: null,
          cTcDzCcl: null,
          cTcDzDh: null,
          cTcDzRh: null,
          cTcDzSh: null,
          cTcDzDr: null,
          cTcDzLj: null,
          cTcZkzhGg: null,
          cTcZkzhGz: null,
          cTcZkzhCcl: null,
          cTcZkzhDh: null,
          cTcZkzhRh: null,
          cTcZkzhSh: null,
          cTcZkzhDr: null,
          cTcZkzhLj: null,
          cTcCpGg: null,
          cTcCpGz: null,
          cTcCpCcl: null,
          cTcCpDh: null,
          cTcCpRh: null,
          cTcCpSh: null,
          cTcCpDr: null,
          cTcCpLj: null,
          cState: null,
          remake: null,
          zfree1: null,
          zfree2: null,
          zfree3: null,
          zfree4: null,
          zfree5: null,
          zfree6: null,
          zfree7: null,
          zfree8: null,
          zfree9: null,
          zfree10: null,
          zfree11: null,
          zfree12: null,
          zfree13: null,
          zfree14: null,
          zfree15: null,
          zfree16: null,
          zfree17: null,
          zfree18: null,
          zfree19: null,
          zfree20: null
        },
        // 表单参数
        form: {},
        // 表单校验
        rules: {},
        isInsert: true,
      };
    },
    created() {
      this.getList();
    },
    methods: {
      /** 查询特材公司生产日报录入列表 */
      getList() {
        this.loading = true;
        listTc(this.queryParams).then(response => {
          this.tcList = response.rows;
          this.total = response.total;
          this.loading = false;
        });
      },
      // 取消按钮
      cancel() {
        this.open = false;
        this.reset();
      },
      // 表单重置
      reset() {
        this.form = {
          cDate: null,
          cTcZpGg: null,
          cTcZpGz: null,
          cTcZpCcl: null,
          cTcZpDh: null,
          cTcZpRh: null,
          cTcZpSh: null,
          cTcZpDr: null,
          cTcZpLj: null,
          cTcZkgyGg: null,
          cTcZkgyGz: null,
          cTcZkgyCcl: null,
          cTcZkgyDh: null,
          cTcZkgyRh: null,
          cTcZkgySh: null,
          cTcZkgyDr: null,
          cTcZkgyLj: null,
          cTcDzGg: null,
          cTcDzGz: null,
          cTcDzCcl: null,
          cTcDzDh: null,
          cTcDzRh: null,
          cTcDzSh: null,
          cTcDzDr: null,
          cTcDzLj: null,
          cTcZkzhGg: null,
          cTcZkzhGz: null,
          cTcZkzhCcl: null,
          cTcZkzhDh: null,
          cTcZkzhRh: null,
          cTcZkzhSh: null,
          cTcZkzhDr: null,
          cTcZkzhLj: null,
          cTcCpGg: null,
          cTcCpGz: null,
          cTcCpCcl: null,
          cTcCpDh: null,
          cTcCpRh: null,
          cTcCpSh: null,
          cTcCpDr: null,
          cTcCpLj: null,
          cState: null,
          remake: null,
          zfree1: null,
          zfree2: null,
          zfree3: null,
          zfree4: null,
          zfree5: null,
          zfree6: null,
          zfree7: null,
          zfree8: null,
          zfree9: null,
          zfree10: null,
          zfree11: null,
          zfree12: null,
          zfree13: null,
          zfree14: null,
          zfree15: null,
          zfree16: null,
          zfree17: null,
          zfree18: null,
          zfree19: null,
          zfree20: null
        };
        this.resetForm("form");
      },
      /** 搜索按钮操作 */
      handleQuery() {
        this.queryParams.pageNum = 1;
        this.getList();
      },
      /** 重置按钮操作 */
      resetQuery() {
        this.resetForm("queryForm");
        this.handleQuery();
      },
      // 多选框选中数据
      handleSelectionChange(selection) {
        this.ids = selection.map(item => item.cDate)
        this.single = selection.length !== 1
        this.multiple = !selection.length
      },
      /** 新增按钮操作 */
      handleAdd() {
        this.reset();
        this.open = true;
        this.isInsert = true;
        this.title = "添加特材公司生产日报录入";
      },
      /** 修改按钮操作 */
      handleUpdate(row) {
        this.reset();
        const cDate = row.cDate || this.ids
        getTc(cDate).then(response => {
          this.form = response.data;
          this.open = true;
          this.isInsert = false;
          this.title = "修改特材公司生产日报录入";
        });
      },
      /** 提交按钮 */
      submitForm() {
        this.$refs["form"].validate(valid => {
          if (valid) {
            if (!this.isInsert) {
              updateTc(this.form).then(response => {
                this.$modal.msgSuccess("修改成功");
                this.open = false;
                this.getList();
              });
            } else {
              addTc(this.form).then(response => {
                this.$modal.msgSuccess("新增成功");
                this.open = false;
                this.getList();
              });
            }
          }
        });
      },
      /** 删除按钮操作 */
      handleDelete(row) {
        const cDates = row.cDate || this.ids;
        this.$modal.confirm('是否确认删除特材公司生产日报录入编号为"' + cDates + '"的数据项？').then(function () {
          return delTc(cDates);
        }).then(() => {
          this.getList();
          this.$modal.msgSuccess("删除成功");
        }).catch(() => {
        });
      },
      /** 导出按钮操作 */
      handleExport() {
        this.download('scrb/tc/export', {
          ...this.queryParams
        }, `tc_${new Date().getTime()}.xlsx`)
      }
    }
  };
</script>
<style lang="scss" scoped>
  table
  {
    border-collapse: collapse;
    margin: 0 auto;
    text-align: center;
  }
  table td, table th
  {
    border: 1px solid #cad9ea;
    color: #666;
    height: 30px;
  }
  table thead th
  {
    background-color: #CCE8EB;
    width: 100px;
  }
  table tr:nth-child(odd)
  {
    background: #fff;
  }
  table tr:nth-child(even)
  {
    background: #F5FAFA;
  }
</style>
